package com.objcat.servicea.service.impl;

import com.objcat.servicea.entity.po.RolePo;
import com.objcat.servicea.entity.vo.UserVo;
import com.objcat.servicea.entity.po.UserRolePo;
import com.objcat.servicea.mapper.RoleMapper;
import com.objcat.servicea.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.objcat.servicea.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author misheep
 * @since 2020-07-27
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, RolePo> implements RoleService {

    @Autowired
    private UserRoleService userRoleService;
    @Autowired
    private RoleMapper roleMapper;

    /**
     * 无用
     * @param rolePo
     * @return
     */
    @Override
    public boolean checkRole(RolePo rolePo) {

        return false;
    }

    /**
     * 获取角色
     * @param userVo
     * @return
     */
    @Override
    public RolePo getRole(UserVo userVo) {
        UserRolePo userRolePo = userRoleService.getUserRole(userVo);
        return roleMapper.selectById(userRolePo.getRoleId());
    }
}
